home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: leeds.ac.uk!news
- From: csyamc@scs.leeds.ac.uk (A M Casey)
- Subject: accessing structures via pointers
- Message-ID: <1996Apr8.144012.25767@leeds.ac.uk>
- NNTP-Posting-Host: csgi33.leeds.ac.uk
- Organization: The University of Leeds, School of Computer Studies
- Date: Mon, 8 Apr 1996 15:40:12 +0100 (BST)
-
- Hi I'm calling the function getgrent(), which resturns a structure
- as defined in grp.h, ie
-
- struct group {
- char *gr_name; /* the name of the group */
- char *gr_passwd; /* the encrypted group password */
- gid_t gr_gid; /* the numerical group ID */
- char **gr_mem; /* vector of pointers to member names */
- };
- the trouble is it returns a pointer to the structure:
-
- struct group *getgrent(void);
-
-
- and I havent got a clue how to access it. I've lookied at the faq, but
- I'm still stuck.
-
- I need something like
-
- printf("the group name is %s\n",tempgroup.gr_name);
-
- but that doesnt work because tempgroup is a pointer.
-
- How do I do this?
-
- Cheers
-
- Andy
-
-